package com.hctforgreen.greenservice.model;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 安装信息
 * 
 * @author ld 20140414
 * 
 */
public class SetupInfoEntity {
	public String id; // 主键ID
	public String machine; // 机型
	public String province; // 省份
	public String city; // 城市
	public String region; // 县\区
	public String street; // 街道
	public String projectName; // 工程名称
	public String owner; // 业主姓名
	public String industry; // 安装行业
	public String searchDate; // 查询时间
	public String remark; // 备注

	public static SetupInfoEntity parse(JSONObject jsonObject) throws Exception {
		SetupInfoEntity entity = new SetupInfoEntity();
		if (jsonObject == null) {
			return entity;
		}
		if (jsonObject.has("id")) {
			entity.id = jsonObject.getString("id");
		}
		if (jsonObject.has("machine")) {
			entity.machine = jsonObject.getString("machine");
		}
		if (jsonObject.has("province")) {
			entity.province = jsonObject.getString("province");
		}
		if (jsonObject.has("city")) {
			entity.city = jsonObject.getString("city");
		}
		if (jsonObject.has("region")) {
			entity.region = jsonObject.getString("region");
		}
		if (jsonObject.has("street")) {
			entity.street = jsonObject.getString("street");
		}
		if (jsonObject.has("projectName")) {
			entity.projectName = jsonObject.getString("projectName");
		}
		if (jsonObject.has("owner")) {
			entity.owner = jsonObject.getString("owner");
		}
		if (jsonObject.has("industry")) {
			entity.industry = jsonObject.getString("industry");
		}

		if (jsonObject.has("machine")) {
			entity.machine = jsonObject.getString("machine");
		}
		if (jsonObject.has("searchDate")) {
			entity.searchDate = jsonObject.getString("searchDate");
		}
		if (jsonObject.has("remark")) {
			entity.remark = jsonObject.getString("remark");
		}

		return entity;
	}

}
